#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <poll.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>

int fd; 

void my_signal_func(int signalnum)
{
	unsigned int keyval;
	read(fd, &keyval, 1);
	printf("keyval : 0x%x\n", keyval);
}

int main(int argc, char **argv)
{
	int Oflags;

	signal(SIGIO, my_signal_func);

	fd = open("/dev/fifth_drv", O_RDWR);
	if(fd < 0)
	{
		printf("Can't open fifthdrv\n\r");
		return -1;
	}

	fcntl(fd, F_SETOWN, getpid());
	
	Oflags = fcntl(fd, F_GETFL); 
	
	fcntl(fd, F_SETFL, Oflags | FASYNC);


	while(1)
	{
		sleep(1000);
	}
}




